import { Tag } from "antd"
import React from "react"

import { useLocale } from "@/locales"

export type OrderStatus = 5 | 6 | 7

interface OrderStatusTagProps {
	status: OrderStatus
}

const OrderStatusTag: React.FC<OrderStatusTagProps> = ({ status }) => {
	const { newFormat } = useLocale()

	const orderStatusMap: Record<OrderStatus, string> = {
		5: newFormat("funds.fund_audit.audit_fail_1"),
		6: newFormat("funds.fund_audit.audit_fail_2"),
		7: newFormat("funds.fund_audit.pass_the_audit")
	}

	const getStatusColor = (status: number) => {
		switch (status) {
			case 7:
				return "success"
			default:
				return "error"
		}
	}

	return <>{!!status || status == 0 ? <Tag color={getStatusColor(status)}>{orderStatusMap[status]}</Tag> : "-"}</>
}

export default OrderStatusTag
